{% extends 'timeline/base.html' %}
{% load i18n %}

{% block title %}
  {% if tl %}
    编辑 {{tl}}
  {% else %}
    创建时间线
  {% endif %}
{% endblock %}


{% block container_top %}
<div id="container_top">
  <div class="sw">
    {% if tl %}
      <a href="{% url timeline_events tl.pk %}">编辑事件</a>
      <span>|</span>
      <a href="{% url timeline_attachs tl.pk %}">图片管理</a>
    {% endif %}
  </div>
  <ul class="sbreadcrumb">
    <li><a href="{% url idx %}">首页</a> <span class="divider">/</span></li>
    {% if tl %}
      <li><a href="{% url timeline_detail tl.pk %}">{{ tl.title }}</a> <span class="divider">/</span></li>
      <li class="active">编辑 {{tl}}</li>
    {% else %}
      <li class="active">创建时间线</li>
    {% endif %}
  </ul>
  <h1>
    {% if tl %}
      编辑 {{tl}}
    {% else %}
      创建时间线
    {% endif %}
  </h1>
</div>
{% endblock %}

{% block sidebar %}
  <div class="sidebar">
    <div style="padding-top: 20px;">
    </div>
  </div>
{% endblock %}

{% block content %}
  <div class="content">
    <hr/>
    <form action="" enctype="multipart/form-data" method="post" class="form-horizontal">
      <fieldset>
        {% csrf_token %}
        {{ form.as_div }}
        <div class="form-actions" class="form-horizontal">
          <p>
            <button type="submit" class="btn btn-primary">提交</button>
            {% if tl %}
              <a class="btn" href="{% url timeline_detail tl.pk %}">取消</a>
            {% else %}
              <a class="btn" href="{% url idx %}">取消</a>
            {% endif %}
          </p>
        </div>
      </fieldset>
    </form>
  </div>
{% endblock %}

{% block footer_ext %}
  {{ block.super }}
  <script type="text/javascript" src="{{ STATIC_URL }}js/jquery.autosize-min.js"></script>
  <script type='text/javascript'>
    $(function () {
      $('textarea').autosize();
    });
  </script>
{% endblock %}
